﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace aPCSuite
{
    public delegate void close_event(object sender, EventArgs e);
    public partial class frmProgress : Form
    {
        public event close_event _close_event = null;
        private bool _manual_close = true;
        private bool _manual_cancel = false;
        public frmProgress()
        {
            InitializeComponent();
            //label1.Font = new Font(label1.Font.FontFamily, 10);
        }

        public bool manual_close
        {
            get { return _manual_close; }
            set { _manual_close = value; }
        }

        public bool manual_cancel
        {
            get { return _manual_cancel; }
            set { _manual_cancel = value; }
        }

        public void SetProgressStatus(string status)
        {
            label1.Text = status;
            label1.Refresh();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            manual_cancel = true;
            manual_close = false;
            if (_close_event != null)
                _close_event(null, EventArgs.Empty);
            this.Close();
        }

        private void Form5_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_close_event != null && manual_close)
                _close_event(null, EventArgs.Empty);/**/
        }
    }
}
